import { Component } from 'react';
class Components extends Component {
    del = (index) => {
        this.props.list.splice(index, 1)
        this.props.dels(index)
    }
    render() {
        return (
            <>
                <div>
                    <ul>
                        {
                            this.props.list.map((item, index) => <li key={index}>
                                <h3>{item.title}</h3>
                                <p>{item.context}</p>
                                <button className='del' onClick={() => this.del(index)}>删除</button>
                            </li>)
                        }
                    </ul>
                </div>
            </>
        );
    }
}

export default Components;